/* D:\ICADDEV\PRJ\ICAD\BHATCHDIALOG.H
 * Copyright (C) 2004-2008 DIMINE Co.LTD. All rights reserved.
 * 
 * Abstract
 * 
 * Bhatch/boundary dialog
 * 
 */ 

#if !defined(AFX_BHATCHDIALOG_H__FD440443_4CD4_11D2_BA83_0060081C2430__INCLUDED_)
#define AFX_BHATCHDIALOG_H__FD440443_4CD4_11D2_BA83_0060081C2430__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "bbhatchpatproptab.h"
#include "bbhatchpatterntab.h"
#include "bbhatchboundarytab.h"


const CString USER = "_USER";

class IcadDialog : public CDialog
{

public:
	IcadDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL) : CDialog(lpszTemplateName, pParentWnd)
	{}

	IcadDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL) : CDialog(nIDTemplate, pParentWnd)
	{}

	IcadDialog() : CDialog() {}


protected:
	virtual BOOL OnInitDialog();
};


////////////////////////////////////////////////////////////
class  BBHatchDialog : public CBCGPPropertySheet
{
	DECLARE_DYNAMIC(BBHatchDialog)

public:
	enum BoundaryEntity {POLYLINE, HATCH};
	enum Tab {BOUNDARY, PATTERN_PROP, PATTERN};

// Construction
//	BBHatchDialog(BoundaryEntity enttype, dmDbHatch *hatch = NULL, CWnd* pParent = NULL,BOOL bSetPatternMode=FALSE);   // standard constructor

	BBHatchDialog(UINT nIDCaption, BoundaryEntity enttype, dmDbHatch *hatch = NULL, CWnd* pParentWnd = NULL, BOOL bSetPatternMode=FALSE,UINT iSelectPage = 0);
	////Fix by Qin
	void RecalcPattern(BOOL Sign=TRUE);
    void RestorePattern();


// Dialog Data
	//{{AFX_DATA(BBHatchDialog)
	enum { IDD = BHATCH_MAIN };
//	CTabCtrl	m_TabCtrl;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(BBHatchDialog)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

public:
	void EnablePatternTab(BOOL enable);
	void RedrawHatch();
	void UndrawHatch();
	void SetHatch(dmDbHatch *hatch)
	{
		m_hatch=hatch;		
	}

	// Hatch will need to be initialized to dialog box settings.
	void InitializeHatch();
	void UpdateHatch();

	BBHatchBoundaryTab m_boundaryTab;
	BBHatchPatPropTab m_patPropTab;
	BBHatchPatternTab m_patternTab;
	

	//Pointer to the hatch being created/modified. This is NULL if bpoly using the dialog.
	dmDbHatch *m_hatch;
	

protected:
	BoundaryEntity m_boundType;
//	Tab m_prevTab;

private:
	// Original system variables.  Since hatch dialog is destroyed while still active (when picking points)
	// Need to save the original system variables so that they can be restored when the user cancels
	int m_origStyle;
	double m_origScale;
	double m_origSpace;
	double m_origAngle;
	int m_origCrossHatch;
	CString m_origName;


	// Generated message map functions
	//{{AFX_MSG(BBHatchDialog)
	virtual BOOL OnInitDialog();
//	afx_msg void OnSelchangeTab2(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDestroy();
//	afx_msg void OnHelp();   //tan fix 2007-93 
//	virtual void OnCancel();
	//virtual void OnOK();


	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.





#endif // !defined(AFX_BHATCHDIALOG_H__FD440443_4CD4_11D2_BA83_0060081C2430__INCLUDED_)


